package LeetCode;

import java.util.LinkedList;

public class Num06 {
    public int[] reversePrint(ListNode head) {
        LinkedList<Integer> list=new LinkedList<>();
        while (head!=null){
            list.addLast(head.val);
            head=head.next;
        }
        int size = list.size();
        int[] arr=new int[size];
        for (int i = 0; i < size; i++) {
            arr[i]=list.pollLast();
        }
        return arr;


    }
}
